package com.edu.glutdataconvertserver.servicce.service;

import com.alibaba.fastjson.JSONObject;
import com.edu.glutdataconvertcommon.common.Constants;
import com.edu.glutdataconvertcommon.domain.*;
import com.edu.glutdataconvertcommon.vo.BaseListVO;
import com.edu.glutdataconvertcommon.vo.EduYhVO;
import com.edu.glutdataconvertcommon.vo.TGlutDcKsbjVO;
import com.edu.glutdataconvertserver.mapper.auto.*;
import com.edu.glutdataconvertserver.mapper.handler.GlutHandlerMapper;
import com.edu.glutdataconvertserver.servicce.CommonService;
import com.edu.glutdataconvertserver.servicce.KwXqbService;
import com.edu.glutdataconvertserver.util.DateUtils;
import com.edu.glutdataconvertserver.util.HashUtils;
import com.edu.glutdataconvertserver.util.IdGen;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author gtl
 * @version 1.0
 * @date 2020/10/26  9:46
 */
@Service
public class ThreadService {

    @Resource
    private TGlutDcJiankaoMapper tGlutDcJiankaoMapper;
    @Resource
    private TGlutDcKsbjMapper tGlutDcKsbjMapper;
    @Resource
    private TGlutDcKsMapper tGlutDcKsMapper;
    @Resource
    private TGlutDcZyjsBjMapper tGlutDcZyjsBjMapper;
    @Resource
    private TGlutDcZyjsMapper tGlutDcZyjsMapper;

    @Autowired
    private EduXyMapper eduXyMapper;
    @Autowired
    private EduKcMapper eduKcMapper;
    @Autowired
    private EduZyMapper eduZyMapper;
    @Autowired
    private EduBjMapper eduBjMapper;
    @Autowired
    private EduBjRkjsMapper eduBjRkjsMapper;
    @Autowired
    private EduBjXsMapper eduBjXsMapper;
    @Autowired
    private EduBjZyMapper eduBjZyMapper;
    @Autowired
    private EduYhMapper eduYhMapper;
    @Autowired
    private EduYhJsMapper eduYhJsMapper;
    @Autowired
    private EduYhXqMapper eduYhXqMapper;
    @Autowired
    private EduTransformCwLogMapper eduTransformCwLogMapper;

    @Autowired
    private KwKsMapper kwKsMapper;
    @Autowired
    private KwJkryapMapper kwJkryapMapper;
    @Autowired
    private KwKsbjMapper kwKsbjMapper;
    @Autowired
    private KwKsbjRkjsMapper kwKsbjRkjsMapper;
    @Autowired
    private KwPkgzMapper kwPkgzMapper;
    @Autowired
    private KwPkxqMapper kwPkxqMapper;
    @Autowired
    private KwPkxqBjMapper kwPkxqBjMapper;
    @Autowired
    private KwSpLcLxKsMapper kwSpLcLxKsMapper;

    @Resource
    private GlutHandlerMapper glutHandlerMapper;

    @Resource
    private CommonService commonService;

    @Async(value = "executor")
    public void xy(TGlutDcBmxx tGlutDcBmxx, EduXx eduXx, EduXqb eduXqb) {
        EduXy eduXy = new EduXy();
        eduXy.setXydm(tGlutDcBmxx.getDwh());
        int i = eduXyMapper.selectCount(eduXy);
        if (i <= 0) {
            eduXy.setXybh(IdGen.uuid());
            eduXy.setEduXxBh(eduXx.getBh());
            eduXy.setLx("1");
            eduXy.setMc(tGlutDcBmxx.getDwmc());
            eduXy.setCjr("1");
            eduXy.setCjsj(new Date());
            eduXy.setGxr("1");
            eduXy.setGxsj(new Date());
            eduXy.setScbj(eduXx.getScbj());
            eduXy.setXxbj(eduXx.getXxbj());
            eduXy.setXqbj(eduXx.getXqbj());
            eduXyMapper.insert(eduXy);
        }
    }

    @Async(value = "executor")
    public void kc(TGlutDcKs data, EduXx eduXx, EduXqb eduXqb, EduXy eduXy) {
        EduKc eduKc = new EduKc();
        eduKc.setKcdm(data.getKch());
        eduKc.setKkxy(eduXy.getXybh());
        int i = eduKcMapper.selectCount(eduKc);
        if (i <= 0) {
            eduKc.setKcmc(data.getKcmc());
            eduKc.setKcxz("0");
            eduKc.setKwxz("0");
            eduKc.setBh(data.getKch());
            eduKc.setEduXxBh(eduXx.getBh());
            eduKc.setCjr("1");
            eduKc.setCjsj(new Date());
            eduKc.setGxr("1");
            eduKc.setGxsj(new Date());
            eduKc.setScbj(eduXx.getScbj());
            eduKc.setXxbj(eduXx.getXxbj());
            eduKc.setXqbj(eduXx.getXqbj());
            eduKcMapper.insertSelective(eduKc);
        }
    }

    @Async(value = "executor")
    public void bj(TGlutDcKsbjVO tGlutDcKsbj, EduXx eduXx, EduXqb eduXqb, Map<String, EduXy> eduXyMcMap,
                   Map<String, EduKc> eduKcMcMap) {
        Date now = new Date();
        List<EduBj> eduBjList = new ArrayList<>();
        List<EduZy> eduZyList = new ArrayList<>();
        List<EduBjZy> eduBjZyList = new ArrayList<>();
        List<EduBjXs> eduBjXsList = new ArrayList<>();
        List<EduBjRkjs> eduBjRkjsList = new ArrayList<>();

        TGlutDcKs tGlutDcKs = new TGlutDcKs();
        tGlutDcKs.setId(tGlutDcKsbj.getKsBh());
        List<TGlutDcKs> dcKsList = tGlutDcKsMapper.select(tGlutDcKs);
        tGlutDcKs = dcKsList.get(0);
        /**
         * 班级
         */
        EduBj eduBj = new EduBj();
        String ssxy = "000000";
        if (StringUtils.isNotBlank(tGlutDcKsbj.getBjbm()) && eduXyMcMap != null) {
            EduXy eduXy = eduXyMcMap.get(tGlutDcKsbj.getBjbm());
            if (eduXy != null) {
                ssxy = eduXy.getXybh();
            }
        }
        eduBj.setBh(tGlutDcKsbj.getBjbh());
        eduBj.setBjbm(tGlutDcKsbj.getBjmc());
        eduBj.setBjmc(tGlutDcKsbj.getBjmc());
        List<EduBj> bjList = eduBjMapper.select(eduBj);
        if (bjList.size() > 0) {
            eduBj = bjList.get(0);
        } else {
            eduBj.setBh(tGlutDcKsbj.getBjbh());
        }
        Integer rs;
        if (StringUtils.isAnyBlank(tGlutDcKsbj.getBjrs())) {
            rs = 0;
        } else {
            rs = Integer.parseInt(tGlutDcKsbj.getBjrs());
        }
        eduBj.setRs(rs);
        eduBj.setBjlx("2");
        eduBj.setSsxy(ssxy);
        eduBj.setEduXxBh(eduXx.getBh());
        eduBj.setScbj(eduXx.getScbj());
        eduBj.setXqbh(eduXqb.getXqbh());
        eduBj.setXxbj(eduXx.getXxbj());
        eduBj.setXqbj(eduXx.getXqbj());

        /**
         * 班级任课教师
         */
        List<TGlutDcKcbJs> tGlutDcKcbJs = glutHandlerMapper.selBjRkjs(tGlutDcKsbj.getKsBh(), eduBj.getBjmc());
        String kcmc = "";
        for (TGlutDcKcbJs tGlutDcKcbJ : tGlutDcKcbJs) {
            EduBjRkjs eduBjRkjs = new EduBjRkjs();
            eduBjRkjs.setEduBjBh(eduBj.getBh());
            eduBjRkjs.setEduYhBh(tGlutDcKcbJ.getRkjsGh());
            kcmc = tGlutDcKs.getKcmc();
            EduKc eduKc = eduKcMcMap.get(kcmc);
            eduBjRkjs.setEduKcKcdm(eduKc.getBh());
            List<EduBjRkjs> bjRkjsList = eduBjRkjsMapper.select(eduBjRkjs);
            if (bjRkjsList.size() > 0) {
                eduBjRkjs = bjRkjsList.get(0);
            } else {
                eduBjRkjs.setBh(IdGen.uuid());
                eduBjRkjs.setEduXxBh(eduBj.getEduXxBh());
                eduBjRkjs.setXxbj(eduBj.getXxbj());
                eduBjRkjs.setXqbj(eduBj.getXqbj());
            }
            if (bjRkjsList.size() > 0) {
                eduBjRkjsMapper.updateByPrimaryKeySelective(eduBjRkjs);
            } else {
                eduBjRkjsList.add(eduBjRkjs);
            }
        }
        if (tGlutDcKcbJs.size() < 1) {
            EduBjRkjs eduBjRkjs = new EduBjRkjs();
            eduBjRkjs.setEduBjBh(eduBj.getBh());
            eduBjRkjs.setEduYhBh("000000");
            EduKc eduKc = eduKcMcMap.get(kcmc);
            if (eduKc == null) {
                eduBjRkjs.setEduKcKcdm("000000");
            } else {
                eduBjRkjs.setEduKcKcdm(eduKc.getBh());
            }
            eduBjRkjs.setBh(IdGen.uuid());
            eduBjRkjs.setEduXxBh(eduBj.getEduXxBh());
            eduBjRkjs.setXxbj(eduBj.getXxbj());
            eduBjRkjs.setXqbj(eduBj.getXqbj());
            eduBjRkjsList.add(eduBjRkjs);
        }
        if (eduBjRkjsList.size() > 1000) {
            eduBjRkjsMapper.insertList(eduBjRkjsList);
            eduBjRkjsList = new ArrayList<>();
        }

        List<TGlutDcZyjsKaosheng> tGlutDcZyjsKaoshengList =
                glutHandlerMapper.selBjXs(tGlutDcKsbj.getKsBh(), eduBj.getBjmc());
        /**
         * 专业和班级专业
         */
        //删除原先的班级专业
        EduBjZy eduBjZy = new EduBjZy();
        eduBjZy.setEduBjBh(eduBj.getBh());
        eduBjZyMapper.delete(eduBjZy);

        List<String> zyMcList = tGlutDcZyjsKaoshengList
                .stream()
                .map(d -> d.getZymc())
                .distinct()
                .collect(Collectors.toList());
        Map<String, String> zymcBhMap = new HashMap<>();
        for (String zyMc : zyMcList) {
            /**
             * 专业
             */
            EduZy eduZy = new EduZy();
            eduZy.setMc(zyMc);
            List<EduZy> select = eduZyMapper.select(eduZy);
            if (select.size() > 0) {
                zymcBhMap.put(zyMc, select.get(0).getBh());
            } else {
                eduZy.setBh(IdGen.uuid());
                eduZy.setZydm(IdGen.uuid());
                eduZy.setEduXxBh(eduBj.getEduXxBh());
                eduZy.setEduXyXybh(eduBj.getSsxy());
                eduZy.setCjr("1");
                eduZy.setCjsj(new Date());
                eduZy.setGxr("1");
                eduZy.setGxsj(new Date());
                eduZy.setScbj(eduBj.getScbj());
                eduZy.setXxbj(eduBj.getXxbj());
                eduZy.setXqbj(eduBj.getXqbj());
                eduZyList.add(eduZy);
                zymcBhMap.put(zyMc, eduZy.getBh());
            }

            /**
             * 班级专业
             */
            eduBjZy = new EduBjZy();
            eduBjZy.setBh(IdGen.uuid());
            eduBjZy.setEduBjBh(eduBj.getBh());
            String nj = tGlutDcZyjsKaoshengList.get(0).getNj();
            eduBjZy.setNj(nj.substring(0, nj.length() - 1));
            eduBjZy.setEduZyZydm(eduZy.getBh());
            eduBjZy.setEduXxBh(eduBj.getEduXxBh());
            eduBjZy.setEduXyBh(eduBj.getSsxy());
            eduBjZy.setXxbj(eduBj.getXxbj());
            eduBjZy.setXqbj(eduBj.getXqbj());
            eduBjZyList.add(eduBjZy);
        }
        if (eduZyList.size() > 1000) {
            eduZyMapper.insertList(eduZyList);
            eduZyList = new ArrayList<>();
        }
        if (eduBjZyList.size() > 1000) {
            eduBjZyMapper.insertList(eduBjZyList);
            eduBjZyList = new ArrayList<>();
        }

        /**
         * 班级学生
         */
        for (TGlutDcZyjsKaosheng tGlutDcZyjsKaosheng : tGlutDcZyjsKaoshengList) {
            EduBjXs eduBjXs = new EduBjXs();
            eduBjXs.setBh(IdGen.uuid());
            eduBjXs.setEduBjBh(eduBj.getBh());
            eduBjXs.setEduYhBh(tGlutDcZyjsKaosheng.getXh());
            eduBjXs.setEduXxBh(eduBj.getEduXxBh());
            String s = zymcBhMap.get(tGlutDcZyjsKaosheng.getZymc());
            eduBjXs.setEduZyZydm(s);
            String nj = tGlutDcZyjsKaosheng.getNj();
            eduBjXs.setNj(nj.substring(0, nj.length() - 1));
            eduBjXs.setSfcx("0");
            eduBjXs.setXxbj(eduBj.getXxbj());
            eduBjXs.setXqbj(eduBj.getXqbj());
            eduBjXsList.add(eduBjXs);
        }
        if (eduBjXsList.size() > 1000) {
            eduBjXsMapper.insertList(eduBjXsList);
            eduBjXsList = new ArrayList<>();
        }
        if (eduBjList.size() > 1000) {
            eduBjMapper.insertList(eduBjList);
            eduBjList = new ArrayList<>();
        }

        if (bjList.size() > 0) {
            eduBj.setGxr(eduXx.getGxr());
            eduBj.setGxsj(now);
            eduBjMapper.updateByPrimaryKeySelective(eduBj);
        } else {
            eduBj.setCjr(eduXx.getCjr());
            eduBj.setCjsj(now);
            eduBj.setGxr(eduXx.getGxr());
            eduBj.setGxsj(now);
            eduBjList.add(eduBj);
        }


        if (eduBjRkjsList.size() > 0) {
            eduBjRkjsMapper.insertList(eduBjRkjsList);
        }
        if (eduBjXsList.size() > 0) {
            eduBjXsMapper.insertList(eduBjXsList);
        }
        if (eduZyList.size() > 0) {
            eduZyMapper.insertList(eduZyList);
        }
        if (eduBjZyList.size() > 0) {
            eduBjZyMapper.insertList(eduBjZyList);
        }
        if (eduBjList.size() > 0) {
            eduBjMapper.insertList(eduBjList);
        }
    }

    @Async(value = "executor")
    public void ks(EduXx eduXx, TGlutDcKs tGlutDcK, EduXqb eduXqb, Map<String, EduXy> eduXyMap,
                   Map<String, EduYh> bhYhLsMap) {
        try {
            Date now = new Date();

            List<String> zyList = new ArrayList<>();
            /**
             * kw_ks
             */
            KwKs kwKs = new KwKs();

            kwKs.setBh(tGlutDcK.getId());
            kwKs.setKch(tGlutDcK.getKch());
            kwKs.setKcmc(tGlutDcK.getKcmc());
            kwKs.setKskm(tGlutDcK.getKcmc());
            kwKs.setKkxymc(tGlutDcK.getKkxy());
            kwKs.setKcbh(tGlutDcK.getKch());
            kwKs.setPkzt("2");
            String kssc = tGlutDcK.getKssc();
            kwKs.setKssc(kssc.substring(0, kssc.length() - 2));
            int ksrs = 0;
            if (StringUtils.isNotBlank(tGlutDcK.getKsrs())) {
                ksrs = Integer.parseInt(tGlutDcK.getKsrs());
            }
            kwKs.setKsrs(ksrs);
            String nj = tGlutDcK.getNj();
            StringBuilder njSb = new StringBuilder();
            if (StringUtils.isNotBlank(nj)) {
                String[] split = nj.split("\\,");
                for (String s : split) {
                    if (StringUtils.isNotBlank(s) && s.length() > 1) {
                        njSb.append(s.substring(0, s.length() - 1));
                    } else {
                        njSb.append(s);
                    }
                }
                kwKs.setNj(njSb.toString());
            } else {
                kwKs.setNj(nj);
            }
            kwKs.setKwPkgzBh(kwKs.getBh());
            kwKs.setKwKslxBh("1");
            kwKs.setEduXqbXqbh(eduXqb.getXqbh());
            EduXy eduXy = eduXyMap.get(tGlutDcK.getKkxy());
            if (eduXy != null) {
                kwKs.setKkxy(eduXy.getXybh());
            }
            /**
             * kw_pkgz
             */
            KwPkgz pkgz = new KwPkgz();
            pkgz.setBh(kwKs.getBh());
            pkgz.setKsrq(tGlutDcK.getKsrq());
            String kssj = tGlutDcK.getKssj();
            pkgz.setKssj(kssj.substring(0, kssj.length() - 3));
            String jssj = tGlutDcK.getJssj();
            pkgz.setJssj(jssj.substring(0, jssj.length() - 3));
            pkgz.setJsbgz("1");
            pkgz.setJkry1gz("0");
            pkgz.setJkry2gz("0");
            pkgz.setZwgz("0");
            pkgz.setEduXxBh(eduXx.getBh());
            pkgz.setEduXqbXqbh(eduXqb.getXqbh());
            pkgz.setScbj("1");
            KwPkgz kwPkgz = kwPkgzMapper.selectByPrimaryKey(pkgz);
            /**
             * kw_pkxq、kw_pkxq_bj、kw_jkryap
             */
            Set<String> pkbjSet = new HashSet<>();
            TGlutDcZyjs tGlutDcZyjs = new TGlutDcZyjs();
            tGlutDcZyjs.setKsBh(kwKs.getBh());
            List<KwPkxq> kwPkxqList = new ArrayList<>();
            List<KwPkxqBj> kwPkxqBjList = new ArrayList<>();
            List<KwJkryap> kwJkryapList = new ArrayList<>();
            BaseListVO vo = new BaseListVO();
            vo.setJsdm("108");
            vo.setSchoolId(eduXx.getBh());
            vo.setXxbj(13);
            List<String> list = new ArrayList<>();
            List<TGlutDcZyjs> zyjsList = tGlutDcZyjsMapper.select(tGlutDcZyjs);
            for (TGlutDcZyjs glutDcZyjs : zyjsList) {
                if (StringUtils.isNotBlank(glutDcZyjs.getKsfs())) {
                    //考试方式 03其它 00闭卷、开卷和未知
                    //系统字典 1开卷 2闭卷 3其它 4未知
                    if (StringUtils.equals("00", glutDcZyjs.getKsfs())) {
                        kwKs.setKsfs("4");
                    } else {
                        kwKs.setKsfs("3");
                    }
                }
                //排考详情
                KwPkxq kwPkxq = new KwPkxq();
                kwPkxq.setBh(glutDcZyjs.getId());
                kwPkxq.setKwKsBh(kwKs.getBh());
                kwPkxq.setKwPkgzBh(kwKs.getKwPkgzBh());
                kwPkxq.setEduJsbJsbh(glutDcZyjs.getJsbdm());
                kwPkxq.setEduXqXqbh(glutDcZyjs.getXqdm());
                kwPkxq.setXqmc(glutDcZyjs.getXqmc());
                kwPkxq.setEduJxlJxlbh(glutDcZyjs.getJxldm());
                kwPkxq.setJxlmc(glutDcZyjs.getJxlmc());
                kwPkxq.setXybh(kwKs.getKkxy());
                kwPkxq.setJsmc(glutDcZyjs.getJsbmc());
                kwPkxq.setXxbj(eduXx.getXxbj());
                kwPkxq.setXqbj(eduXx.getXqbj());
                kwPkxq.setEduXxBh(eduXx.getBh());
                kwPkxq.setEduXqbXqbh(eduXqb.getXqbh());
                kwPkxq.setScbj("1");
                KwPkxq pkxq = kwPkxqMapper.selectByPrimaryKey(kwPkxq);
                if (pkxq == null) {
                    kwPkxq.setCjr("1");
                    kwPkxq.setCjsj(new Date());
                    kwPkxq.setGxr("1");
                    kwPkxq.setGxsj(new Date());
                    kwPkxqList.add(kwPkxq);
                } else {
                    kwPkxq.setGxr("1");
                    kwPkxq.setGxsj(new Date());
                    kwPkxqMapper.updateByPrimaryKeySelective(kwPkxq);
                }


                //排考详情班级
                List<TGlutDcZyjsBj> zyjsBjList = glutHandlerMapper.selPkxqBj(glutDcZyjs.getId(), kwKs.getBh());

                if (zyjsBjList.size() < 1) {
                    kwKs.setPkzt("1");
                }
                /*TGlutDcZyjsBj tGlutDcZyjsBj = new TGlutDcZyjsBj();
                tGlutDcZyjsBj.setZyjsBh(glutDcZyjs.getId());
                List<TGlutDcZyjsBj> zyjsBjList = tGlutDcZyjsBjMapper.select(tGlutDcZyjsBj);*/
                for (TGlutDcZyjsBj glutDcZyjsBj : zyjsBjList) {
                    KwPkxqBj kwPkxqBj = new KwPkxqBj();
                    kwPkxqBj.setKwKsBh(kwKs.getBh());
                    kwPkxqBj.setKwPkgzBh(kwKs.getKwPkgzBh());
                    kwPkxqBj.setBjbh(kwKs.getBh() + glutDcZyjsBj.getBjmc());
                    kwPkxqBj.setKwPkxqBh(kwPkxq.getBh());
                    KwPkxqBj pkxqBj = kwPkxqBjMapper.selectOne(kwPkxqBj);
                    kwPkxqBj.setBh(IdGen.uuid());
                    kwPkxqBj.setKwKslxBh(kwKs.getKwKslxBh());
                    kwPkxqBj.setBjbm(glutDcZyjsBj.getBjmc());
                    int wss = 0;
                    if (StringUtils.isNotBlank(glutDcZyjsBj.getBjrs())) {
                        wss = Integer.parseInt(glutDcZyjsBj.getBjrs());
                    }
                    kwPkxqBj.setWss(wss);
                    kwPkxqBj.setXxbj(eduXx.getXxbj());
                    kwPkxqBj.setXqbj(eduXx.getXqbj());
                    //根据班级名称查询考生来源
                    List<String> kslyList = glutHandlerMapper.getKsly(glutDcZyjsBj.getBjmc());
                    StringBuilder kslySb = new StringBuilder();
                    for (String s : kslyList) {
                        kslySb.append(s).append(",");
                    }
                    String ksly = kslySb.toString();
                    if (StringUtils.isNotBlank(ksly) && ksly.length() > 1) {
                        kwPkxqBj.setKsly(ksly.substring(0, ksly.length() - 1));
                    } else {
                        kwPkxqBj.setKsly(ksly);
                    }
                    pkbjSet.add(kwPkxqBj.getBjbh());
                    if (pkxqBj == null) {
                        kwPkxqBjList.add(kwPkxqBj);
                    } else {
                        Example example = new Example(KwPkxqBj.class);
                        example.createCriteria()
                                .andEqualTo("kwKsBh", kwPkxqBj.getKwKsBh())
                                .andEqualTo("bjbh", kwPkxqBj.getBjbh())
                                .andEqualTo("kwPkxqBh", kwPkxqBj.getKwPkxqBh());
                        kwPkxqBjMapper.updateByExampleSelective(kwPkxqBj, example);
                    }
                }

                List<TGlutDcJiankao> dcJiankaoList = glutHandlerMapper.selJk(glutDcZyjs.getId(), kwKs.getBh());

                if (dcJiankaoList.size() < 1) {
                    kwKs.setPkzt("1");
                }

                //监考人员安排
                /*TGlutDcJiankao tGlutDcJiankao = new TGlutDcJiankao();
                tGlutDcJiankao.setZyjsBh(glutDcZyjs.getId());
                List<TGlutDcJiankao> dcJiankaoList = tGlutDcJiankaoMapper.select(tGlutDcJiankao);*/
                for (TGlutDcJiankao glutDcJiankao : dcJiankaoList) {
                    KwJkryap kwJkryap = new KwJkryap();
                    kwJkryap.setBh(glutDcJiankao.getId());
                    kwJkryap.setEduYhBh(glutDcJiankao.getJkrdm());
                    kwJkryap.setGh(glutDcJiankao.getJkrdm());
                    kwJkryap.setJsxm(glutDcJiankao.getJkrxm());
                    kwJkryap.setKwPkxqBh(kwPkxq.getBh());
                    if (StringUtils.equals("是", glutDcJiankao.getSfzjk())) {
                        kwJkryap.setIsZjk("1");
                    } else {
                        kwJkryap.setIsZjk("0");
                    }
                    kwJkryap.setEduXqbXqbh(kwKs.getEduXqbXqbh());
                    kwJkryap.setKwKslxBh(kwKs.getKwKslxBh());
                    kwJkryap.setXybh(kwPkxq.getXybh());
                    kwJkryap.setXxbj(eduXx.getXxbj());
                    kwJkryap.setXqbj(eduXx.getXqbj());
                    KwJkryap jkryap = kwJkryapMapper.selectByPrimaryKey(kwJkryap);
                    if (jkryap == null) {
                        kwJkryapList.add(kwJkryap);
                    } else {
                        kwJkryapMapper.updateByPrimaryKeySelective(kwJkryap);
                    }

                    //添加用户角色
                    list.add(glutDcJiankao.getJkrdm());
                }
            }
            /**
             * kw_ksbj、kw_ksbj_rkjs
             */
            Set<String> ksbjSet = new HashSet<>();
            List<TGlutDcKsbjVO> dcKsbjList = glutHandlerMapper.selBj(Constants.DCND + Constants.DCXQ, kwKs.getBh());

            if (dcKsbjList.size() < 1) {
                return;
            }
            if (kwPkxqList.size() > 0) {
                kwPkxqMapper.insertList(kwPkxqList);
            }
            if (kwPkxqBjList.size() > 0) {
                kwPkxqBjMapper.insertList(kwPkxqBjList);
            }
            if (kwJkryapList.size() > 0) {
                kwJkryapMapper.insertList(kwJkryapList);
            }
            /*TGlutDcKsbj tGlutDcKsbj = new TGlutDcKsbj();
            tGlutDcKsbj.setKsBh(kwKs.getBh());
            List<TGlutDcKsbj> dcKsbjList = tGlutDcKsbjMapper.select(tGlutDcKsbj);*/
            List<KwKsbj> kwKsbjList = new ArrayList<>();
            List<KwKsbjRkjs> kwKsbjRkjsList = new ArrayList<>();
            for (TGlutDcKsbjVO glutDcKsbj : dcKsbjList) {
                //考试班级
                KwKsbj kwKsbj = new KwKsbj();
                kwKsbj.setKwKsBh(kwKs.getBh());
                //原先数据班级编码不对
                kwKsbj.setBjbh(kwKs.getBh() + glutDcKsbj.getBjmc());
                KwKsbj ksbj = kwKsbjMapper.selectOne(kwKsbj);
                kwKsbj.setBh(IdGen.uuid());
                kwKsbj.setKwKsLxBh(kwKs.getKwKslxBh());
                //原先数据班级编码不对
                kwKsbj.setBjbm(glutDcKsbj.getBjmc());
                kwKsbj.setBjmc(glutDcKsbj.getBjmc());
                int bjrs = 0;
                if (StringUtils.isNotBlank(glutDcKsbj.getBjrs())) {
                    bjrs = Integer.parseInt(glutDcKsbj.getBjrs());
                }
                kwKsbj.setBjrs(bjrs);
                kwKsbj.setNjzy(glutDcKsbj.getZymc());
                zyList.add(kwKsbj.getNjzy());
                nj = glutDcKsbj.getNj();
                if (StringUtils.isNotBlank(nj)) {
                    kwKsbj.setNj(nj.substring(0, nj.length() - 1));
                }
                kwKsbj.setEduXxBh(eduXx.getBh());
                kwKsbj.setEduXqbXqbh(eduXqb.getXqbh());
                kwKsbj.setXqmc(eduXqb.getMc());
                kwKsbj.setScbj(eduXx.getScbj());
                kwKsbj.setXxbj(eduXx.getXxbj());
                kwKsbj.setXqbj(eduXx.getXqbj());
                ksbjSet.add(kwKsbj.getBjbh());
                if (ksbj == null) {
                    kwKsbj.setCjr("1");
                    kwKsbj.setCjsj(new Date());
                    kwKsbj.setGxr("1");
                    kwKsbj.setGxsj(new Date());
                    kwKsbjList.add(kwKsbj);
                } else {
                    kwKsbj.setCjr("1");
                    kwKsbj.setCjsj(new Date());
                    Example example = new Example(KwKsbj.class);
                    example.createCriteria()
                            .andEqualTo("kwKsBh", kwKsbj.getKwKsBh())
                            .andEqualTo("bjbh", kwKsbj.getBjbh());
                    kwKsbjMapper.updateByExampleSelective(kwKsbj, example);
                }

                //考试班级任课老师
                List<TGlutDcKcbJs> tGlutDcKcbJs = glutHandlerMapper.selBjRkjs(kwKs.getBh(), kwKsbj.getBjmc());

                /*TGlutDcJxhbxx tGlutDcJxhbxx = new TGlutDcJxhbxx();
                tGlutDcJxhbxx.setBjmc(kwKsbj.getBjmc());
                List<TGlutDcJxhbxx> jxhbxxList = tGlutDcJxhbxxMapper.select(tGlutDcJxhbxx);*/
                KwKsbjRkjs kwKsbjRkjs = new KwKsbjRkjs();
                kwKsbjRkjs.setKwKsbjBh(kwKsbj.getBh());
                List<KwKsbjRkjs> ksbjRkjsList = kwKsbjRkjsMapper.select(kwKsbjRkjs);
                List<KwKsbjRkjs> addKsbjRkjsList = compareRkjs(tGlutDcKcbJs, ksbjRkjsList, kwKsbj, eduXx, bhYhLsMap);
                if (addKsbjRkjsList.size() > 0) {
                    kwKsbjRkjsList.addAll(addKsbjRkjsList);
                }
            }
            if (kwKsbjList.size() > 0) {
                kwKsbjMapper.insertList(kwKsbjList);
            }
            if (kwKsbjRkjsList.size() > 0) {
                kwKsbjRkjsMapper.insertList(kwKsbjRkjsList);
            }
            StringBuilder zySb = new StringBuilder();
            zyList = zyList.stream().distinct().collect(Collectors.toList());
            for (String s : zyList) {
                zySb.append(s).append(",");
            }
            String zy = zySb.toString();
            if (StringUtils.isNotBlank(zy) && zy.length() > 1) {
                kwKs.setZymc(zy.substring(0, zy.length() - 1));
            } else {
                kwKs.setZymc(zy);
            }
            if (pkbjSet.size() < 1 || pkbjSet.size() < ksbjSet.size()) {
                kwKs.setPkzt("1");
            }
            kwKs.setGxr("1");
            kwKs.setKwPkgzBh(pkgz.getBh());
            KwKs ks = kwKsMapper.selectByPrimaryKey(kwKs);
            if (ks == null) {
                kwKs.setCjr("1");
                kwKs.setKwKslxBh("1");
                kwKs.setEduXqbXqbh(eduXqb.getXqbh());
                kwKs.setShzt("0");
                kwKs.setDyzt("0");
                kwKs.setKszt("0");
                kwKs.setKsxs("1");
                kwKs.setEduXxBh(eduXx.getBh());
                kwKs.setXqmc(eduXqb.getMc());
                kwKs.setCjsj(now);
                kwKs.setGxsj(now);
                kwKs.setScbj(eduXx.getScbj());
                kwKs.setXxbj(eduXx.getXxbj());
                kwKs.setXqbj(eduXx.getXqbj());
                kwKsMapper.insertSelective(kwKs);
                KwSpLcLxKs kwSpLcLxKs = new KwSpLcLxKs();
                kwSpLcLxKs.setBh(IdGen.uuid());
                kwSpLcLxKs.setKwSpLcLxBh("1");
                kwSpLcLxKs.setKwKsBh(kwKs.getBh());
                kwSpLcLxKs.setEduXxBh(kwKs.getEduXxBh());
                kwSpLcLxKs.setCjr("1");
                kwSpLcLxKs.setGxr("1");
                kwSpLcLxKs.setCjsj(now);
                kwSpLcLxKs.setGxsj(now);
                kwSpLcLxKs.setScbj(eduXx.getScbj());
                kwSpLcLxKs.setXxbj(eduXx.getXxbj());
                kwSpLcLxKs.setXqbj(eduXx.getXqbj());
                kwSpLcLxKsMapper.insertSelective(kwSpLcLxKs);
            } else {
                /*
                 * 查询是否需要修改命题截至时间
                 * 考试日期改变并且原先的命题截至时间为考试日期减去7天，那么改为现在的截至时间减去7天
                 */
                if (ks.getMtjzsj() != null) {
                    String ksrqOld = kwPkgz.getKsrq();
                    String ksrqNew = pkgz.getKsrq();
                    if (!StringUtils.equals(ksrqNew, ksrqOld)) {
                        String pznr = glutHandlerMapper.getPz("defultMtjzsj");
                        JSONObject jsonObject = JSONObject.parseObject(pznr);
                        Object o = jsonObject.get("sl");
                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
                        Date defaultMtjzsjOld = DateUtils.plusDay(Integer.parseInt(o.toString()), format.parse(ksrqOld));
                        if (StringUtils.equals(format.format(defaultMtjzsjOld), format.format(ks.getMtjzsj()))) {
                            Date defaultMtjzsjNew = DateUtils.plusDay(Integer.parseInt(o.toString()), format.parse(ksrqNew));
                            kwKs.setMtjzsj(defaultMtjzsjNew);
                        }
                    }
                }

                kwKs.setGxsj(now);
                kwKsMapper.updateByPrimaryKeySelective(kwKs);
            }
            vo.setList(list);
            if (list.size() > 0) {
                commonService.addYhJsMulTran(vo);
            }
            if (kwPkgz == null) {
                pkgz.setCjr("1");
                pkgz.setCjsj(new Date());
                pkgz.setGxr("1");
                pkgz.setGxsj(new Date());
                kwPkgzMapper.insertSelective(pkgz);
            } else {
                pkgz.setGxr("1");
                pkgz.setGxsj(new Date());
                kwPkgzMapper.updateByPrimaryKeySelective(pkgz);
            }
        } catch (Exception e) {
            EduTransformCwLog eduTransformCwLog = new EduTransformCwLog();
            eduTransformCwLog.setBh(IdGen.uuid());
            eduTransformCwLog.setSj(JSONObject.toJSONString(tGlutDcK));
            eduTransformCwLog.setCwyy(e.toString());
            eduTransformCwLog.setCjsj(new Date());
            eduTransformCwLogMapper.insertSelective(eduTransformCwLog);
            e.printStackTrace();
        }
    }

    @Async(value = "executor")
    public void pkxq(EduXx eduXx, EduXqb eduXqb, KwKs kwKs) {
        try {
            /**
             * kw_pkxq、kw_pkxq_bj、kw_jkryap
             */
            TGlutDcZyjs tGlutDcZyjs = new TGlutDcZyjs();
            tGlutDcZyjs.setKsBh(kwKs.getBh());
            List<KwPkxq> kwPkxqList = new ArrayList<>();
            List<KwPkxqBj> kwPkxqBjList = new ArrayList<>();
            List<TGlutDcZyjs> zyjsList = tGlutDcZyjsMapper.select(tGlutDcZyjs);
            for (TGlutDcZyjs glutDcZyjs : zyjsList) {
                //排考详情
                KwPkxq kwPkxq = new KwPkxq();
                kwPkxq.setBh(glutDcZyjs.getId());
                kwPkxq.setKwKsBh(kwKs.getBh());
                kwPkxq.setKwPkgzBh(kwKs.getKwPkgzBh());
                kwPkxq.setEduJsbJsbh(glutDcZyjs.getJsbdm());
                kwPkxq.setEduXqXqbh(glutDcZyjs.getXqdm());
                kwPkxq.setXqmc(glutDcZyjs.getXqmc());
                kwPkxq.setEduJxlJxlbh(glutDcZyjs.getJxldm());
                kwPkxq.setJxlmc(glutDcZyjs.getJxlmc());
                kwPkxq.setXybh(kwKs.getKkxy());
                kwPkxq.setJsmc(glutDcZyjs.getJsbmc());
                kwPkxq.setXxbj(eduXx.getXxbj());
                kwPkxq.setXqbj(eduXx.getXqbj());
                kwPkxq.setEduXxBh(eduXx.getBh());
                kwPkxq.setEduXqbXqbh(eduXqb.getXqbh());
                kwPkxq.setScbj("1");
                KwPkxq pkxq = kwPkxqMapper.selectByPrimaryKey(kwPkxq);
                if (pkxq == null) {
                    kwPkxq.setCjr("1");
                    kwPkxq.setCjsj(new Date());
                    kwPkxq.setGxr("1");
                    kwPkxq.setGxsj(new Date());
                    kwPkxqList.add(kwPkxq);
                } else {
                    kwPkxq.setGxr("1");
                    kwPkxq.setGxsj(new Date());
                    kwPkxqMapper.updateByPrimaryKeySelective(kwPkxq);
                }

                //排考详情班级
                TGlutDcZyjsBj tGlutDcZyjsBj = new TGlutDcZyjsBj();
                tGlutDcZyjsBj.setZyjsBh(glutDcZyjs.getId());
                List<TGlutDcZyjsBj> zyjsBjList = tGlutDcZyjsBjMapper.select(tGlutDcZyjsBj);
                for (TGlutDcZyjsBj glutDcZyjsBj : zyjsBjList) {
                    KwPkxqBj kwPkxqBj = new KwPkxqBj();
                    kwPkxqBj.setKwKsBh(kwKs.getBh());
                    kwPkxqBj.setKwPkgzBh(kwKs.getKwPkgzBh());
                    kwPkxqBj.setBjbh(kwKs.getBh() + glutDcZyjsBj.getBjmc());
                    kwPkxqBj.setKwPkxqBh(kwPkxq.getBh());
                    KwPkxqBj pkxqBj = kwPkxqBjMapper.selectOne(kwPkxqBj);
                    kwPkxqBj.setBh(IdGen.uuid());
                    kwPkxqBj.setKwKslxBh(kwKs.getKwKslxBh());
                    kwPkxqBj.setBjbm(glutDcZyjsBj.getBjmc());
                    int wss = 0;
                    if (StringUtils.isNotBlank(glutDcZyjsBj.getBjrs())) {
                        wss = Integer.parseInt(glutDcZyjsBj.getBjrs());
                    }
                    kwPkxqBj.setWss(wss);
                    kwPkxqBj.setXxbj(eduXx.getXxbj());
                    kwPkxqBj.setXqbj(eduXx.getXqbj());
                    //根据班级名称查询考生来源
                    List<String> kslyList = glutHandlerMapper.getKsly(glutDcZyjsBj.getBjmc());
                    StringBuilder kslySb = new StringBuilder();
                    for (String s : kslyList) {
                        kslySb.append(s).append(",");
                    }
                    String ksly = kslySb.toString();
                    if (StringUtils.isNotBlank(ksly) && ksly.length() > 1) {
                        kwPkxqBj.setKsly(ksly.substring(0, ksly.length() - 1));
                    } else {
                        kwPkxqBj.setKsly(ksly);
                    }
                    if (pkxqBj == null) {
                        kwPkxqBjList.add(kwPkxqBj);
                    } else {
                        Example example = new Example(KwPkxqBj.class);
                        example.createCriteria()
                                .andEqualTo("kwKsBh", kwPkxqBj.getKwKsBh())
                                .andEqualTo("bjbh", kwPkxqBj.getBjbh())
                                .andEqualTo("kwPkxqBh", kwPkxqBj.getKwPkxqBh());
                        kwPkxqBjMapper.updateByExampleSelective(kwPkxqBj, example);
                    }
                }
            }
            if (kwPkxqList.size() > 0) {
                kwPkxqMapper.insertList(kwPkxqList);
            }
            if (kwPkxqBjList.size() > 0) {
                kwPkxqBjMapper.insertList(kwPkxqBjList);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private List<KwKsbjRkjs> compareRkjs(List<TGlutDcKcbJs> tGlutDcKcbJs, List<KwKsbjRkjs> ksbjRkjsList,
                                         KwKsbj kwKsbj, EduXx eduXx, Map<String, EduYh> bhYhLsMap) {
        List<KwKsbjRkjs> addList = new ArrayList<>();

        Map<String, String> rkjsBjMap = new HashMap<>();
        for (KwKsbjRkjs kwKsbjRkjs : ksbjRkjsList) {
            rkjsBjMap.put(kwKsbjRkjs.getRkjsBh(), kwKsbjRkjs.getBh());
        }
        List<String> jxList;
        if (tGlutDcKcbJs.size() > 0) {
            jxList = tGlutDcKcbJs.stream().map(d -> d.getRkjsGh()).collect(Collectors.toList());
        } else {
            jxList = new ArrayList<>();
            KwKsbjRkjs kwKsbjRkjs = new KwKsbjRkjs();
            kwKsbjRkjs.setBh(IdGen.uuid());
            kwKsbjRkjs.setKwKsbjBh(kwKsbj.getBh());
            kwKsbjRkjs.setRkjsBh("000000");
            kwKsbjRkjs.setRkjsGh("000000");
            kwKsbjRkjs.setRkjkMc("未知老师");
            kwKsbjRkjs.setXxbj(eduXx.getXxbj());
            kwKsbjRkjs.setXqbj(eduXx.getXqbj());
            addList.add(kwKsbjRkjs);
        }

        //查询添加的数据
        for (TGlutDcKcbJs glutDcKcbJs : tGlutDcKcbJs) {
            String s = rkjsBjMap.get(glutDcKcbJs.getRkjsGh());
            if (StringUtils.isAnyBlank(s)) {
                KwKsbjRkjs kwKsbjRkjs = new KwKsbjRkjs();
                kwKsbjRkjs.setBh(IdGen.uuid());
                kwKsbjRkjs.setKwKsbjBh(kwKsbj.getBh());
                //????没有任课教室名称
                EduYh eduYh = bhYhLsMap.get(glutDcKcbJs.getRkjsGh());
                if (eduYh != null) {
                    kwKsbjRkjs.setRkjkMc(eduYh.getXm());
                }
                kwKsbjRkjs.setRkjsBh(glutDcKcbJs.getRkjsGh());
                kwKsbjRkjs.setRkjsGh(glutDcKcbJs.getRkjsXm());
                kwKsbjRkjs.setXxbj(eduXx.getXxbj());
                kwKsbjRkjs.setXqbj(eduXx.getXqbj());
                addList.add(kwKsbjRkjs);
            }
        }

        //查询删除的数据
        for (KwKsbjRkjs kwKsbjRkjs : ksbjRkjsList) {
            boolean contains = jxList.contains(kwKsbjRkjs.getRkjsBh());
            if (!contains) {
                kwKsbjRkjsMapper.deleteByPrimaryKey(kwKsbjRkjs);
            }
        }
        return addList;
    }

    @Async(value = "executor")
    public void yhMm(EduYh eduYh) {
        String yhm = eduYh.getYhm();
        String yhmm = yhm.replaceAll("glut", "");
        eduYh.setYhmm(HashUtils.encryPassword(yhmm));
        eduYhMapper.updateByPrimaryKeySelective(eduYh);
    }

    @Async(value = "executor")
    public void xs(EduXx eduXx, EduXqb eduXqb, EduYhVO eduYhVO, Map<String, EduXy> eduXyMcMap) {
        EduYh eduYh1 = eduYhMapper.selectByPrimaryKey(eduYhVO.getXh());

        //学生不更新数据
        if (eduYh1 != null) {
            return;
        }
        EduYh eduYh = new EduYh();
        eduYh.setBh(eduYhVO.getXh());
        eduYh.setYhm(eduXx.getXxjc() + eduYhVO.getXh());
        eduYh.setYhmm(HashUtils.encryPassword(eduYhVO.getXh()));
        eduYh.setXm(eduYhVO.getXm());
        eduYh.setLx("2");
        eduYh.setZt("1");
        eduYh.setJzsj("0");
        eduYh.setEduXxBh(eduXx.getBh());
        eduYh.setFirstFlag("1");
        eduYh.setSdbj("1");
        eduYh.setScbj(eduXx.getScbj());
        eduYh.setXxbj(eduXx.getXxbj());
        eduYh.setXqbj(eduXx.getXqbj());

        EduYhXq eduYhXq = new EduYhXq();
        eduYhXq.setEduYhBh(eduYh.getBh());
        EduXy eduXy = eduXyMcMap.get(eduYhVO.getSsxy());
        if (eduXy == null) {
            eduYhXq.setSsxy("000000");
        } else {
            eduYhXq.setSsxy(eduXy.getXybh());
        }
        eduYhXq.setXb(StringUtils.equals(eduYhVO.getXb(), "男") ? "1" : "2");
        if (StringUtils.isNotBlank(eduYhVO.getNj())) {
            eduYhXq.setNj(eduYhVO.getNj().replace("级", ""));
        }
        eduYhXq.setZy(eduYhVO.getZy());
        eduYhXq.setXh(eduYhVO.getXh());
        eduYhXq.setXxbj(eduYh.getXxbj());
        eduYhXq.setXqbj(eduYh.getXqbj());
        if (eduYh1 == null) {
            eduYh.setCjr(eduXx.getCjr());
            eduYh.setCjsj(new Date());
            eduYh.setGxr(eduXx.getGxr());
            eduYh.setGxsj(new Date());

            eduYhMapper.insertSelective(eduYh);
            eduYhXqMapper.insertSelective(eduYhXq);
            EduYhJs eduYhJs = new EduYhJs();
            eduYhJs.setEduYhBh(eduYh.getBh());
            eduYhJs.setEduJsJsdm("110");
            eduYhJs.setCjr(eduYh.getCjr());
            eduYhJs.setCjsj(eduYh.getCjsj());
            eduYhJs.setGxr(eduYh.getGxr());
            eduYhJs.setGxsj(eduYh.getGxsj());
            eduYhJs.setScbj(eduYh.getScbj());
            eduYhJs.setXxbj(eduYh.getXxbj());
            eduYhJs.setXqbj(eduYh.getXqbj());
            eduYhJsMapper.insertSelective(eduYhJs);
        } else {
            eduYh.setGxr(eduXx.getGxr());
            eduYh.setGxsj(new Date());
            eduYhMapper.updateByPrimaryKeySelective(eduYh);
            Example example = new Example(EduYhXq.class);
            example.createCriteria()
                    .andEqualTo("eduYhBh", eduYh.getBh());
            eduYhXqMapper.updateByExampleSelective(eduYhXq, example);
        }
    }

    @Async(value = "executor")
    public void ls(ViewGlutJwKsqlcJgxx data, EduXx eduXx, Map<String, EduXy> eduXyMcMap) {
        EduYh eduYh1 = eduYhMapper.selectByPrimaryKey(data.getGh());

        //老师不更新数据
        if (eduYh1 != null) {
            return;
        }
        EduYh eduYh = new EduYh();
        eduYh.setBh(data.getGh());
        eduYh.setYhm(eduXx.getXxjc() + data.getGh());
        eduYh.setYhmm(HashUtils.encryPassword(data.getGh()));
        eduYh.setXm(data.getXm());
        eduYh.setLx("1");
        eduYh.setZt("1");
        eduYh.setJzsj("0");
        eduYh.setEduXxBh(eduXx.getBh());
        eduYh.setFirstFlag("1");
        eduYh.setSdbj("1");
        eduYh.setScbj(eduXx.getScbj());
        eduYh.setXxbj(eduXx.getXxbj());
        eduYh.setXqbj(eduXx.getXqbj());

        EduYhXq eduYhXq = new EduYhXq();
        eduYhXq.setEduYhBh(eduYh.getBh());
        EduXy eduXy = eduXyMcMap.get(data.getDwmc());
        if (eduXy == null) {
            eduYhXq.setSsxy("00000");
        } else {
            eduYhXq.setSsxy(eduXy.getXybh());
        }
        eduYhXq.setJsgh(data.getGh());
        eduYhXq.setXxbj(eduYh.getXxbj());
        eduYhXq.setXqbj(eduYh.getXqbj());
        if (eduYh1 == null) {
            eduYh.setCjr(eduXx.getCjr());
            eduYh.setCjsj(new Date());
            eduYh.setGxr(eduXx.getGxr());
            eduYh.setGxsj(new Date());

            eduYhMapper.insertSelective(eduYh);
            eduYhXqMapper.insertSelective(eduYhXq);
        } else {
            eduYh.setGxr(eduXx.getGxr());
            eduYh.setGxsj(new Date());
            eduYhMapper.updateByPrimaryKeySelective(eduYh);
            Example example = new Example(EduYhXq.class);
            example.createCriteria()
                    .andEqualTo("eduYhBh", eduYh.getBh());
            eduYhXqMapper.updateByExampleSelective(eduYhXq, example);
        }
    }
}
